#ifndef _NEPTUNER_SCOPE_H_
#define _NEPTUNER_SCOPE_H_

#include<string>
#include"tokenizer.h"
#include"SymbolTable.h"
#include"Symbol.h"

class Scope
{
public:
    enum Type;
    //TODO Change to private
    Scope::Type					m_eType;
	std::string					m_sScopeEnder;

    Scope*						m_pxParent;		//Parent, symbols should be available.
    std::vector<Scope*>			m_apxChild;		//Children, symbols should not be available. Can't ask for money from children! :)
	std::vector<Scope*>			m_apxRelative;	//Relatives, symbols should be available.

    std::vector<Token>			m_axBody;
    std::vector<std::string>	m_asElement;
	SymbolTable*				m_pxSymbolTable;
	std::string					m_sName;

	std::string					m_sLastKeyword;


public:
    Scope();
    ~Scope();
    void print();
	void printSymbols();
	void addRelative(Scope* in_pxScope);

    virtual Scope* parse(Token& inToken, bool &bIsEndOfScope);
    //Note: bIsEndofScope = true and non-null return is illegal.

	Scope::Type  getScopeType()
	{
		return m_eType;
	}

	virtual bool isComment();
	virtual bool isCode();
	virtual bool isFunction();

	virtual bool canDefineFunction();
	virtual bool canDefineVariable();
	virtual bool canDefineType();

	bool findSymbol(std::string& in_sTestSymbol, Symbol& out_Symbol);

	std::string& getName();
	std::string  getText();

public:
    enum Type
    {
        eScopeInvalid=0,
        eScopeGlobal,
        eScopeParen,
        eScopeCommentC,
        eScopeCommentCPP,
        eScopeBlock,
        eScopeBracket,
        eScopePreprocessor, 
        eScopeLiteral
    };
};

#endif

